<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="../../static/BOSGeo/BOSGeo.css" />
  <title>添加海量实体</title>
  <style>
    html {
      font-size: 12px;
    }

    html,
    body,
    #mapContainer {
      height: 100%;
      width: 100%;
      padding: 0;
      margin: 0;
    }

  </style>
</head>

<body>
  <div id="mapContainer"></div>
  <script src="../../static/BOSGeo/BOSGeo.js"></script>
  <script>
    var map = new BOSGeo.Map('mapContainer', {
    mapType: BOSGeo.TDT_IMAGERY
    });

    var layers = map.layers;
    var primitiveCollection = new BOSGeo.LayerCollection({
    name: 'primitive图形集合',
    type: 'primitive'
    });
    layers.add(primitiveCollection);
    var primitive = new BOSGeo.PrimitiveLayer({
        name: '图形',
        type: 'polygon', // 'line', 'polygon', 'rect', 'ellipse', 'pipeline' 'tube'
        // polygon时首位坐标要相同
        position: [[121.46665, 31.17088, 121.4663, 31.16701, 121.46384, 31.1663 , 121.46351, 31.16834, 121.46665, 31.17088]],
        // width: 6,
        height: 0,
        displayDistance: 10000,
        // 为line和polygon时 此属性为true则不传高度。若此属性为false或者不设置则需要传高度如[[121.46665, 31.17088, 0, 121.4663, 31.16701, 0, 121.46384, 0, 121.46665, 31.17088, 0]]
        clampToGround: true,
        show: true,
        color: '#49a8f9',
        // onClick: layer => {
        //     // layer.zoomTo();
        // }
    });
    primitiveCollection.add(primitive);
    map.viewFix(121.4658, 31.16493, 1000, {
    heading: 283.40944,
    pitch: -84.58174,
    roll: 178.23488
    })
  </script>
</body>

</html>